/* $Header: apg_bus.h,v 2.3 02/04/09 13:21:00 przybyls Exp $ */

/***********************************************************************/
/* INCLUDE FILE NAME:                                                  */
/* ==================                                                  */
/*                                                                     */
/* Author:                                                             */
/*                                                                     */
/* COMMENT:                                                            */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/***********************************************************************/

#ifndef FNAME_H
#define FNAME_H

/*****************************/
/*   IFDEFS                  */
/*****************************/


/*****************************/
/*   SYMBOLIC CONSTANTS      */
/*****************************/

#define   VALID_VIREO_APG         0x63
#define   UNUSED_VIREO_APG        0x9C

/*****************************/
/*   MACROS                  */
/*****************************/


/*****************************/
/*   TYPEDEFS                */
/*****************************/

typedef struct {
                    unsigned Start_Relay     : 1;  /* bit 7 */   /* 0 = close start run relay */
                    unsigned Stop            : 1;  /* bit 6 */   /* pin 8 */
                    unsigned Ready           : 1;  /* bit 5 */   /* pin 7 */
                    unsigned Unused_4        : 1;  /* bit 4 */   /* pin 9, Start request */

                    unsigned Reserved        : 1;  /* bit 3 */   /* pin 5 */
                    unsigned Unused_2        : 1;  /* bit 2 */   /* pin 4, Shutdown */
                    unsigned Start           : 1;  /* bit 1 */   /* pin 3 */
                    unsigned Prepare         : 1;  /* bit 0 */   /* pin 2 */


                } APG_BUS_STRUCT;

typedef union
        {
           BIT8 byte;
           APG_BUS_STRUCT apg;
        } APG_OUTPUT;



/*****************************/
/*   STATIC VARIABLES        */
/*****************************/

extern INT8   Apg_Prepare_Pulse_Width;
extern INT8   Apg_Start_Request_Pulse_Width;
extern INT8   Apg_Start_Pulse_Width;
extern INT8   Apg_Stop_Pulse_Width;

extern APG_BUS_STRUCT Apg_Out_Image;        /* value of apg_out last time written */
extern APG_BUS_STRUCT Prev_Apg_In_Image;    /* value of apg_in  last time read    */



/*****************************/
/*   FUNCTION PROTOTYPES     */
/*****************************/


/* used for yanking on edge sensitive lines */
extern void AssertApgPrepare(void);
extern void AssertApgStartRequest(void);
extern void AssertApgStart(void);
extern void AssertApgStop(void);

#endif
